import { createApp } from "vue"
import App from "./App.vue"
import Hello from "./Hello.vue"

// 创建应用
const app = createApp(App)
// 注册全局组件
app.component("Hello", Hello)

// 定义全局属性(官方不建议)
app.config.globalProperties.x = 123

// 消除全局属性的ts类型检查告警
declare module "vue" {
  interface ComponentCustomProperties {
    x: number
  }
}

// 注册全局指令
app.directive("beauty", (element, { value }) => {
  element.innerText += value
  element.style.color = "green"
  element.style.backgroundColor = "yellow"
})
// 卸载组件
setTimeout(() => {
  // app.unmount()
}, 2000)

// 安装插件,如app.use(router)
// app.use()

// 挂载应用
app.mount("#app")
